let back = document.querySelector(".back");

let host = "http://127.0.0.1:1337";
let token = localStorage.getItem("token");
// 获取用户信息
let user = document.querySelector(".order-head-right .user");
// 获取用户名
let uinfoUrl = host + "/api/v1/user/info";
// 头部设置token参数
axios.defaults.headers.common["token"] = token;
let uname = axios.get(uinfoUrl);

uname.then(function(res) {
    let userName = res.data.data.userName;
    user.innerHTML = userName;
})


back.onclick = function() {
    location.href = "index.html"
}

let span = document.querySelector(".countDown span");

let n = 5;
let timer = setInterval(() => {
     if(n>0) {
         n--;
         span.innerHTML = n;
     }
}, 1000);

setTimeout(() => {
    window.open("login.html");
}, 5000);

